home *** CD-ROM | disk | FTP | other *** search
- //: C17:Find.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // Find a group of characters in a string
- #include <string>
- #include <iostream>
- using namespace std;
-
- int main() {
- string chooseOne("Eenie, meenie, miney, mo");
- int i = chooseOne.find("een");
- while(i != string::npos) {
- cout << i << endl;
- i++;
- i = chooseOne.find("een", i);
- }
- } ///:~
-